package com.buer.storage.business.service.impl;

import com.buer.storage.business.dao.UserEntityDao;
import com.buer.storage.business.domain.UserEntity;
import com.buer.storage.business.service.UserEntityService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;



@Service
public class UserEntityServiceImpl implements UserEntityService {
	@Autowired
	private UserEntityDao entityDao;
	
	@Override
	public UserEntity get(Integer userId){
		return entityDao.get(userId);
	}
	
	@Override
	public List<UserEntity> list(Map<String, Object> map){
		return entityDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return entityDao.count(map);
	}
	
	@Override
	public int save(UserEntity entity){
		return entityDao.save(entity);
	}
	
	@Override
	public int update(UserEntity entity){
		return entityDao.update(entity);
	}
	
	@Override
	public int remove(Integer userId){
		return entityDao.remove(userId);
	}
	
	@Override
	public int batchRemove(Integer[] userIds){
		return entityDao.batchRemove(userIds);
	}

    @Override
    public PageInfo<UserEntity> getEntityList(Map<String, Object> map) {
        PageHelper.startPage(map); //开始起始页
        List<UserEntity> list = entityDao.getEntityList(map); // 获取数据
        PageInfo<UserEntity> page = new PageInfo<>(list); // 实例化PageInfo
        return page;
    }

    @Override
    public UserEntity getOne(Map<String, Object> map){
        return entityDao.getOne(map);
    }
	
}
